<script>
 const varTest = hasKey(data, 'test.type') && data.test.type === 'test' ? "isTest" :
                 (hasKey(data, 'data.pest.name') && otheVar === data.test.name ? "otherTest" : null);

 const isTest = hasKey(data, 'test.type') && data.test.type === 'test' &&
                hasKey(data, 'data.pest.name') && otheVar === data.test.name;
</script>
